///根据后台返回定义
class BaseResponse<T> {
  // class BaseRespose<T> {//想达到的效果
  int? status;
  String? msg;
  T? data;

  BaseResponse({this.status, this.msg, this.data});

  BaseResponse.fromJson(Map<String, dynamic> json,
      {T Function(dynamic json)? fromJsonT}) {
    status = json['status'];
    msg = json['msg'];
    if (fromJsonT == null) {
      data = json['data'];
    } else {
      data = json['data'] == null ? null : fromJsonT(json['data']);
    }
  }

  Map<String, dynamic> toJson() => {'status': status, 'msg': msg, 'data': data};

  @override
  String toString() {
    StringBuffer sb = StringBuffer('{');
    sb.write('\'status\':\'$status\'');
    sb.write('\'msg\':\'$msg\'');
    sb.write('\'data\':\'$data\'');
    sb.write('}');
    return sb.toString();
  }
}
